//TIP 要<b>运行</b>代码，请按 <shortcut actionId="Run"/> 或
// 点击装订区域中的 <icon src="AllIcons.Actions.Execute"/> 图标。
import wxy.Observer.*;

public class Main {
    public static void main(String[] args) {
        //TIP 当文本光标位于高亮显示的文本处时按 <shortcut actionId="ShowIntentionActions"/>
        // 查看 IntelliJ IDEA 建议如何修正。
        System.out.println("开始测试观察者模式");

        NewsPublisher publisher = new NewsPublisher();

        Subscriber subscriber1 = new Subscriber("观察者 1");
        Subscriber subscriber2 = new Subscriber("观察者 2");

        publisher.registerObserver(subscriber1);
        publisher.registerObserver(subscriber2);

        publisher.publishNews("测试消息11111111");

        publisher.removeObserver(subscriber2);

        publisher.publishNews("测试消息2222222");
    }
}